package com.haiyou.dc.api.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 支付常量
 *
 * @author huangzl
 */
public class PayConstant {

    /**
     * 购买类型：1个体，2批发
     */
    @Getter
    @AllArgsConstructor
    public enum BuyTypeEnum {

        INDIVIDUAL("1", "个体"),
        WHOLESALE("2", "批发");

        private String type;
        private String remark;

    }

    /**
     * 后台是否确认批发可以支付，1是，0否，默认0
     * 只用于批发购买
     */
    @Getter
    @AllArgsConstructor
    public enum ConfirmBatchBuyEnum {

        YES("1", "是"),
        NO("0", "否");

        private String type;
        private String remark;

    }

    /**
     * 支付方式：1现金，2积分
     */
    @Getter
    @AllArgsConstructor
    public enum PayTypeEnum {

        PAY_PRICE("1", "现金"),
        PAY_INTEGRAL("2", "积分"),
        PAY_POSTAGE("3", "运费");

        private String type;
        private String remark;

    }

    /**
     * 支付状态：0:未支付,1:已支付,2配送中，3已完成，4已取消
     */
    @Getter
    @AllArgsConstructor
    public enum PayStatusEnum {

        UNPAID("0", "未支付"),
        PAID("1", "已支付"),
        DISTRIBUTION("2", "配送中"),
        COMPLETED("3", "已完成"),
        CANCELLED("4", "已取消");

        private String type;
        private String remark;

        public static PayStatusEnum getOrderStatus(String status) {
            for (PayStatusEnum payStatus : values()) {
                if (payStatus.getType().equals(status)) {
                    return payStatus;
                }
            }
            return values()[0];
        }

    }
}